package com.demo.thread.bbp;

/**
 * @author : YU.TAN
 * @date : 2021/11/5 11:47
 */
public class Producer implements Runnable{

    SyncStack stack=null;

    Producer(SyncStack stack){
        this.stack=stack;
    }

    @Override
    public void run() {
        //开始生产
        for (int i = 0; i < 20; i++) {
            SteamBread steamBread=new SteamBread(i);
            stack.push(steamBread);
            System.out.println("生产了"+i+"号馒头"+steamBread);

            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
